import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld';
let Home =()=> import ("@/components/Home/Home");
let Classify =()=> import ("@/components/Classify/Classify");
let Cart =()=> import ("@/components/Cart/Cart");
let Myself =()=> import ("@/components/Myself/Myself");
let NAVs =()=> import ("@/components/NAVs/NavsLoast")
let logo =()=> import ("@/components/logo/logo")
let shopdesc =()=> import ("@/components/shopdesc/shopdesc")
let anlie =()=> import ("@/components/anlie/anlie")
let anlie2 =()=> import ("@/components/anlie2/anlie2")
let shopcar =()=> import ("@/components/shopcar/shopcar")
Vue.use(Router)


export default new Router({
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld,
      meta:{
           title:"首页"
      },
      // beforeEnter:(to, from, next) => {

      //       // console.log(to);  //即将要进入的路由对象
      //       // console.log(from); //当前导航要离开的路由对象
      //       // console.log("11111")
      //       // console.log(to)
      //       // console.log(this)
  
      //         document.title = to.meta.title;  //在路由里面写入的meta里面的title字段
  
      //     next()
      //     },
    },
    {
      path: '/Classify',
      // name: 'HelloWorld',
      component:Classify,
    },
    {
      path: '/Home',
      // name: 'HelloWorld',
      component:Home,
      meta:{
        title:"主頁"
   },
     
    },
    {
      path: '/Cart',
      name: 'Cart',
      component:Cart,
      meta:{
        title:"购物车"
   },
    },
    {
      path: '/Myself',
      name: 'myself',
      component:Myself,
      // 路由独享首卫
      beforeEnter: (to, from, next) => {
        console.log(1,to)
      next()
      },
      meta:{
        title:"Myself"
   },
    },
    {
      path: '/NAVs',
      // name: 'HelloWorld',
      component:NAVs,
      meta:{
        title:"NAVs"
   },
    },
    {
      path: '/logo',
      // name: 'HelloWorld',
      component:logo,
      meta:{
        title:"logo"
   },
    },
    {
      path: '/shopdesc/:id',
      name: 'shopdesc',
      component:shopdesc,
      meta:{
        title:"shopdesc"
   },
    },
    {
      path: '/anlie',
      name: 'anlie',
      component:anlie,
      meta:{
        title:"anlie"
   },
    },
    {
      path: '/anlie2/:id',
      name: 'anlie2',
      component:anlie2,
      meta:{
        title:"anlie2"
   },
    },
    {
      path: '/shopcar',
      name: 'shopcar',
      component:shopcar,
      meta:{
        title:"shopcar"
   },
    }
  ]
})
